<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8" />
  <title>Objcet.definePropentry1</title>
  <!-- 引入Vue -->
  <script type="text/javascript" src="../js/vue.js"></script>
</head>

<body>
  <!-- 准备好一个容器-->
  <div id="demo">

  </div>
</body>

<script type="text/javascript">
  let person = {
    name: '马志晶',
    age: 18,
  }
  // 给对象添加属性
  person.gender = '男'
  // console.log(person);

  // 借助Object.defindeproperty 给对象添加属性 实现'高级定制'
  Object.defineProperty(person, 'car', {
    value: '吉利-星越L', //具体的属性值
    enumerable: true,  //属性是否可以被枚举(遍历)
    configurable: true, //属性是够可以被删除
    writable: false    //属性值是否可以被修改
  })

  delete car in person
  person.car = 'L780'
  for (x in person) {
    console.log(person[x]);
  }

</script>

</html>